//
//  CustomView.swift
//  LovelyKeyborad-Extenxion
//
//  Created by Wade on 2025/1/15.
//

import Foundation
import UIKit

class CustomUIView: UIView {
    var headerView:UIView?
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = .green // 设置背景色为青色
        
        let headerView = UIView(frame: CGRectMake(0, 0, UIScreen.main.bounds.size.width, 50))
        self.headerView = headerView
        self.headerView?.backgroundColor = .clear
        self.addSubview(self.headerView!)
        
        let iconImage = UIImageView(frame: CGRectMake(10, 5, 40, 40))
        headerView.addSubview(iconImage)
        iconImage.image = .init(named: "AppIcon_40x40_")
        iconImage.backgroundColor = .white
        iconImage.layer.cornerRadius = 20;
        iconImage.clipsToBounds = true
        
        let segment = UISegmentedControl(items: ["帮我回","超会说"])
        segment.selectedSegmentIndex = 0
        segment.frame = CGRectMake(60, 5, 140, 40)
        headerView.addSubview(segment)
        
        let segment3 = UISegmentedControl(items: ["帮我回","超会说"])
        segment3.selectedSegmentIndex = 0
        segment3.frame = CGRectMake(60, 200, 140, 40)
        self.addSubview(segment3)
        
        
        let segment2 = UIButton(type: .custom)
        segment2.setTitle("测试", for: .normal)
        segment2.setTitleColor(.black, for: .normal)
        segment2.setTitleColor(.white, for: .highlighted)
        segment2.frame = CGRectMake(60, 150, 140, 40)
        segment2.addTarget(self, action: #selector(addbtnClick), for: .touchUpInside)
        self.addSubview(segment2)

    }
    
    @objc func addbtnClick(){
        print("addbtnClick")
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
}
